# 数据的导入
# 三种方式
# CSV 特征：1.以逗号分隔 2.文件头：字段属性

# 标准Python库导入
from csv import reader
import numpy as np

filename = '附件2.csv'
with open(filename,'rt',encoding='GBK') as row_data:
    readers = reader(row_data,delimiter=',')
    x = list(readers)
    data = np.array(x)
    print(data.shape)

# numpy导入
from numpy import loadtxt

filename = '附件2.csv'
with open(filename, 'rt',encoding='gbk') as raw_data:
    data = loadtxt(raw_data, delimiter=',')
    print(data.shape)

# Pandas导入
from pandas import read_csv

filename = '附件2.csv'
names = ['方向','时间','车牌号','交叉口']
data = read_csv(filename, names=names)
# print(data.shape)

head = data.head(10)
print(head)